<!DOCTYPE html>
<html>
<head>
    <title>评价任务</title>
		<#include "/header.html">
</head>
<body>
<div id="rrapp" v-cloak>
    <div v-show="showList">
        <div class="grid-btn">
            <#if shiro.hasPermission("eval:evaltask:info")>
            <a class="btn btn-primary" @click="detail"><i class="fa fa-info"></i>&nbsp;查看</a>
            </#if>
			<#if shiro.hasPermission("eval:evaltask:save")>
            <a class="btn btn-primary" @click="add"><i class="fa fa-plus"></i>&nbsp;创建</a>
			</#if>
			<#if shiro.hasPermission("eval:evaltask:update")>
            <a class="btn btn-primary" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</a>
			</#if>
            <#if shiro.hasPermission("eval:evaltask:release")>
            <a class="btn btn-primary" @click="release"><i class="fa fa-pencil-square-o"></i>&nbsp;发布</a>
            </#if>
            <#if shiro.hasPermission("eval:evaltask:close")>
            <a class="btn btn-primary" @click="close"><i class="fa fa-pencil-square-o"></i>&nbsp;关闭</a>
            </#if>
            <#if shiro.hasPermission("eval:evaltask:result")>
            <a class="btn btn-primary" @click="generateResult"><i class="fa fa-pencil-square-o"></i>&nbsp;生成评价结果</a>
            </#if>
			<#if shiro.hasPermission("eval:evaltask:delete")>
            <a class="btn btn-primary" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</a>
			</#if>
        </div>
        <table id="jqGrid"></table>
        <div id="jqGridPager"></div>
    </div>

    <div v-show="showAdd" class="panel panel-default">
        <div class="panel-heading">{{title}}</div>
        <form class="form-horizontal" style="width: 1000px;">
            <div v-show="addStep==1">
                <div class="form-group">
                    <div class="col-sm-2 control-label">提示</div>
                    <div class="col-sm-6">
                        <textarea  class="form-control" rows="2" readonly placeholder="填写评价名称、选择评价部门（会对部门下所有人员进行评价）、选填备注信息（备注有利于别人理解评价任务目的等）。"></textarea>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-2 control-label">名称</div>
                    <div class="col-sm-6">
                        <input type="text" class="form-control" v-model="evalTask.name" placeholder="名称"/>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-2 control-label">所属部门</div>
                    <div class="col-sm-6">
                        <input type="text" class="form-control" style="cursor:pointer;" v-model="evalTask.deptName" @click="deptTree" readonly="readonly" placeholder="所属部门"/>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-2 control-label">备注</div>
                    <div class="col-sm-6">
                        <textarea  class="form-control" v-model="evalTask.remark" rows="6"></textarea>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-4 control-label"></div>
                    <a class="btn btn-primary" @click="addStepNext"><i class="fa fa-arrow-right"></i>&nbsp;下一步</a>
                    &nbsp;&nbsp;
                    <input type="button" class="btn btn-warning" @click="reload" value="取消"/>
                </div>
            </div>
            <div v-show="addStep==2">
                <div class="form-group">
                    <div class="col-sm-2 control-label">提示</div>
                    <div class="col-sm-6">
                        <textarea  class="form-control" rows="2" readonly placeholder="学生评价占比（学生评价在评价任务中所占的比例，由评价标准所来），学生评价部门与评价任务部门一致（无法修改）。"></textarea>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-2 control-label">学生评价占比</div>
                    <div class="col-sm-6">
                        <div class="input-group">
                            <input type="text" class="form-control" v-model="evalTask.studentPercentage" placeholder="百分比"/>
                            <div class="input-group-addon">%</div>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-4 control-label"></div>
                    <a class="btn btn-primary" @click="addStepPre"><i class="fa fa-arrow-left"></i>&nbsp;上一步</a>
                    &nbsp;&nbsp;
                    <a class="btn btn-primary" @click="addStepNext"><i class="fa fa-arrow-right"></i>&nbsp;下一步</a>
                    &nbsp;&nbsp;
                    <input type="button" class="btn btn-warning" @click="reload" value="取消"/>
                </div>
            </div>
            <div v-show="addStep==3">
                <div class="form-group">
                    <div class="col-sm-2 control-label">提示</div>
                    <div class="col-sm-6">
                        <textarea  class="form-control" rows="4" readonly placeholder="定义同行评价子任务。同行评价占比（在评价任务中所占的比例）。同行评价任务项目共同组成同行评价，每个项目都有自己具体所占比例。同行评价详情为评价任务具体部门组成，由每个部门负责人（需要指定）进行评价。"></textarea>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-2 control-label">同行评价占比</div>
                    <div class="col-sm-6">
                        <div class="input-group">
                            <input type="text" class="form-control" v-model="evalTask.colleaguePercentage" placeholder="百分比"/>
                            <div class="input-group-addon">%</div>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-2 control-label">同行评价项目</div>
                    <div class="col-sm-10">
                        <div class="row">
                            <div class="col-sm-1"></div>
                            <input type="button" class="btn btn-primary" @click="showAddSubTaskItemLayer('colleague')" value="添加同行评价项目"/>
                        </div>
                        <div class="row" v-for="(item, index) in evalTask.colleagueEvalTaskItems" :key="index">
                            <div class="col-sm-1">{{index + 1}}</div>
                            <div class="col-sm-5">
                                <div class="input-group">
                                    <span class="input-group-addon">项目名称</span>
                                    <input type="text" class="form-control" :value="item.name" v-model="evalTask.colleagueEvalTaskItems[index].name" placeholder="项目名称"/>
                                </div>
                            </div>
                            <div class="col-sm-4">
                                <div class="input-group">
                                    <span class="input-group-addon">占比</span>
                                    <input type="text" class="form-control" :value="item.percentage" v-model="evalTask.colleagueEvalTaskItems[index].percentage" placeholder="百分比"/>
                                    <div class="input-group-addon">%</div>
                                </div>
                            </div>
                            <div class="col-sm-1">
                                <a class="btn btn-primary" @click="deleteSubTaskItem('colleague',index)"><i class="fa fa-trash"></i>&nbsp;删除</a>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-2 control-label">同行评价详情</div>
                    <div class="col-sm-10">
                        <div class="row" v-for="(item, index) in evalTask.colleagueEvalTasks">
                            <div class="col-sm-1">{{index + 1}}</div>
                            <div class="col-sm-5">
                                <div class="input-group">
                                    <span class="input-group-addon">部门名称</span>
                                    <input type="text" class="form-control" :value="item.deptName" placeholder="同行评价部门" readonly/>
                                </div>
                            </div>
                            <div class="col-sm-5">
                                <div class="input-group">
                                    <span class="input-group-addon">评价负责人</span>
                                    <input type="text" class="form-control" :value="item.userName" @click="addColleagueTask(index,item.deptId)" placeholder="系主任/同行" readonly/>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-4 control-label"></div>
                    <a class="btn btn-primary" @click="addStepPre"><i class="fa fa-arrow-left"></i>&nbsp;上一步</a>
                    &nbsp;&nbsp;
                    <a class="btn btn-primary" @click="addStepNext"><i class="fa fa-arrow-right"></i>&nbsp;下一步</a>
                    &nbsp;&nbsp;
                    <input type="button" class="btn btn-warning" @click="reload" value="取消"/>
                </div>
            </div>
            <div v-show="addStep==4">
                <div class="form-group">
                    <div class="col-sm-2 control-label">提示</div>
                    <div class="col-sm-6">
                        <textarea  class="form-control" rows="2" readonly placeholder="定义督导评价子任务。可修改督导评价占比。可定义督导评价具体项目。需要在督导任务详情，指定督导任务具体执行人。"></textarea>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-2 control-label">督导评价占比</div>
                    <div class="col-sm-6">
                        <div class="input-group">
                            <input type="text" class="form-control" v-model="evalTask.inspectorPercentage" placeholder="百分比"/>
                            <div class="input-group-addon">%</div>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-2 control-label">督导评价项目</div>
                    <div class="col-sm-10">
                        <div class="row">
                            <div class="col-sm-1"></div>
                            <input type="button" class="btn btn-primary" @click="showAddSubTaskItemLayer('inspector')" value="添加督导评价项目"/>
                        </div>
                        <div class="row" v-for="(item, index) in evalTask.inspectorEvalTaskItems"  :key="index">
                            <div class="col-sm-1">{{index + 1}}</div>
                            <div class="col-sm-5">
                                <div class="input-group">
                                    <span class="input-group-addon">项目名称</span>
                                    <input type="text" class="form-control" :value="item.name" v-model="evalTask.inspectorEvalTaskItems[index].name" placeholder="项目名称"/>
                                </div>
                            </div>
                            <div class="col-sm-4">
                                <div class="input-group">
                                    <span class="input-group-addon">占比</span>
                                    <input type="text" class="form-control" :value="item.percentage" v-model="evalTask.inspectorEvalTaskItems[index].percentage" placeholder="百分比"/>
                                    <div class="input-group-addon">%</div>
                                </div>
                            </div>
                            <div class="col-sm-1">
                                <a class="btn btn-primary" @click="deleteSubTaskItem('inspector',index)"><i class="fa fa-trash"></i>&nbsp;删除</a>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-2 control-label">督导任务详情</div>
                    <div class="col-sm-10">
                        <div class="row">
                            <div class="col-sm-1"></div>
                            <input type="button" class="btn btn-primary" @click="addInspectorTask" value="添加督导人员"/>
                        </div>
                        <div class="row" v-for="(item, index) in evalTask.inspectorEvalTasks">
                            <div class="col-sm-1">{{index + 1}}</div>
                            <div class="col-sm-5">
                                <div class="input-group">
                                    <span class="input-group-addon">督导姓名</span>
                                    <input type="text" class="form-control" :value="item.userName" placeholder="督导姓名" readonly/>
                                </div>
                            </div>
                            <div class="col-sm-1">
                                <a class="btn btn-primary" @click="deleteInspectorTask(index)"><i class="fa fa-trash"></i>&nbsp;删除</a>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-4 control-label"></div>
                    <a class="btn btn-primary" @click="addStepPre"><i class="fa fa-arrow-left"></i>&nbsp;上一步</a>
                    &nbsp;&nbsp;
                    <a class="btn btn-primary" @click="addStepNext"><i class="fa fa-arrow-right"></i>&nbsp;下一步</a>
                    &nbsp;&nbsp;
                    <input type="button" class="btn btn-warning" @click="reload" value="取消"/>
                </div>
            </div>
            <div v-show="addStep==5">
                <div class="form-group">
                    <div class="col-sm-2 control-label">提示</div>
                    <div class="col-sm-6">
                        <textarea  class="form-control" rows="2" readonly placeholder="定义其他评价子任务。可修改其他评价占比，其他评价所属部门与评价任务部门一致（无法修改）。"></textarea>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-2 control-label">其他评价占比</div>
                    <div class="col-sm-6">
                        <div class="input-group">
                            <input type="text" class="form-control" v-model="evalTask.otherPercentage" placeholder="百分比"/>
                            <div class="input-group-addon">%</div>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-4 control-label"></div>
                    <a class="btn btn-primary" @click="addStepPre"><i class="fa fa-arrow-left"></i>&nbsp;上一步</a>
                    &nbsp;&nbsp;
                    <input type="button" class="btn btn-primary" id="btnSaveOrUpdate" data-loading-text="保存中..." @click="saveOrUpdate" value="确定"/>
                    &nbsp;&nbsp;
                    <input type="button" class="btn btn-warning" @click="reload" value="取消"/>
                </div>
            </div>
        </form>
    </div>

    <div v-show="showDetail" class="panel panel-default">
        <div class="panel-heading">{{title}}</div>
        <div  class="form-horizontal" style="width: 1000px;">
            <div class="form-group">
                <div class="col-sm-2 control-label">名称</div>
                <div class="col-sm-4">
                    <span class="label label-info">{{evalTask.name}}</span>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">所属部门</div>
                <div class="col-sm-4">
                    <span class="label label-info">{{evalTask.deptName}}</span>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">创建时间</div>
                <div class="col-sm-4">
                    <span class="label label-info">{{evalTask.createTime}}</span>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">状态</div>
                <div class="col-sm-4">
                    <span v-if='evalTask.status==0' class="label label-default">新建</span>
                    <span v-else-if="evalTask.status==1" class="label label-success">发布</span>
                    <span v-else-if="evalTask.status==2" class="label label-danger">关闭</span>
                    <span v-else class="label label-info">完成</span>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">评价标准</div>
                <div class="col-sm-8">
                    <table class="table table-hover">
                        <thead>
                        <tr>
                            <th>评价项目</th>
                            <th>评价比例</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr class="active">
                            <td>学生评价</td>
                            <td>{{evalTask.studentPercentage}}%</td>
                        </tr>
                        <tr class="success">
                            <td>同行评价</td>
                            <td>{{evalTask.colleaguePercentage}}%</td>
                        </tr>
                        <tr class="warning">
                            <td>督导评价</td>
                            <td>{{evalTask.inspectorPercentage}}%</td>
                        </tr>
                        <tr class="danger">
                            <td>其他评价</td>
                            <td>{{evalTask.otherPercentage}}%</td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">学生评价详情</div>
                <div class="col-sm-8">
                    <table class="table table-hover">
                        <thead>
                        <tr>
                            <th>评价部门</th>
                            <th>学生评价进度(完成人数/总人数)</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr>
                            <td>{{evalTask.deptName}}</td>
                            <td>{{evalTask.studentEvalTask.schedule}}/{{evalTask.headcount}}</td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">同行评价项目</div>
                <div class="col-sm-8">
                    <table class="table table-hover">
                        <thead>
                        <tr>
                            <th>序号</th>
                            <th>项目名称</th>
                            <th>比例</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr v-for="(item, index) in evalTask.colleagueEvalTaskItems" :key="index">
                            <td>{{index+1}}</td>
                            <td>{{item.name}}</td>
                            <td>{{item.percentage}}%</td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">同行评价详情</div>
                <div class="col-sm-8">
                    <table class="table table-hover">
                        <thead>
                        <tr>
                            <th>序号</th>
                            <th>评价部门</th>
                            <th>评价执行人</th>
                            <th>同行评价进度(完成人数/总人数)</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr v-for="(item, index) in evalTask.colleagueEvalTasks" :key="index">
                            <td>{{index+1}}</td>
                            <td>{{item.deptName}}</td>
                            <td>{{item.userName}}</td>
                            <td>{{item.schedule}}/{{item.headcount}}</td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">督导评价项目</div>
                <div class="col-sm-8">
                    <table class="table table-hover">
                        <thead>
                        <tr>
                            <th>序号</th>
                            <th>项目名称</th>
                            <th>比例</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr v-for="(item, index) in evalTask.inspectorEvalTaskItems" :key="index">
                            <td>{{index+1}}</td>
                            <td>{{item.name}}</td>
                            <td>{{item.percentage}}%</td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">督导评价详情</div>
                <div class="col-sm-8">
                    <table class="table table-hover">
                        <thead>
                        <tr>
                            <th>序号</th>
                            <th>评价部门</th>
                            <th>评价执行人</th>
                            <th>督导评价进度(完成人数/总人数)</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr v-for="(item, index) in evalTask.inspectorEvalTasks" :key="index">
                            <td>{{index+1}}</td>
                            <td>{{evalTask.deptName}}</td>
                            <td>{{item.userName}}</td>
                            <td>{{item.schedule}}/{{evalTask.headcount}}</td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">其他评价详情</div>
                <div class="col-sm-8">
                    <table class="table table-hover">
                        <thead>
                        <tr>
                            <th>评价部门</th>
                            <th>其他评价进度(完成人数/总人数)</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr>
                            <td>{{evalTask.deptName}}</td>
                            <td>{{evalTask.otherEvalTask.schedule}}/{{evalTask.headcount}}</td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-4 control-label"></div>
                &nbsp;&nbsp;
                <input type="button" class="btn btn-warning" @click="reload" value="返回"/>
            </div>
        </div>
    </div>

<!-- 添加子任务选项 -->
<div id="subTaskItemLayer" style="display: none;padding:10px;">
    <div class="row">
        <div class="col-sm-2 control-label">名称</div>
        <div class="col-sm-10">
            <input type="text" class="form-control" v-model="subTaskItem.name" placeholder="名称"/>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-2 control-label">百分比</div>
        <div class="col-sm-10">
            <div class="input-group">
                <input type="text" class="form-control" v-model="subTaskItem.percentage" placeholder="百分比"/>
                <div class="input-group-addon">%</div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-2 control-label">备注</div>
        <div class="col-sm-10">
            <textarea id="remark" class="form-control" v-model="subTaskItem.remark" rows="6"></textarea>
        </div>
    </div>



</div>

<!-- 选择部门 -->
<div id="deptLayer" style="display: none;padding:10px;">
    <ul id="deptTree" class="ztree"></ul>
</div>

<!-- 选择用户 -->
<div id="userLayer" style="display: none;padding:10px;">
        <div class="row">
            <div class="col-sm-4">
                选择部门
            </div>
            <div class="col-sm-8">
                选择具体执行人
            </div>
        </div>
        <div class="row">
            <div class="col-sm-4">
                <ul id="deptTree1" class="ztree"></ul>
            </div>
            <div class="col-sm-8">
                <div class="row">
                    <div class="col-sm-9">
                        <div class="input-group">
                            <div class="input-group-addon">姓名</div>
                            <input type="text" class="form-control" @change="findUser" v-model="layer.qName" placeholder="输入姓名"/>
                        </div>
                    </div>
                    <div class="col-sm-3">
                        <input type="button" class="btn btn-primary" @click="findUser" value="搜索"/>
                    </div>
                </div>
                <div class="col-sm-12">
                    <table class="table table-fixed">
                        <thead>
                            <tr>
                                <th class="col-sm-6">工号</th>
                                <th class="col-sm-6">姓名</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr v-for="(user,index) in layer.userList" @click="layerChooseUser(index)">
                                <td class="col-sm-6">{{ user.username }}</td>
                                <td class="col-sm-6">{{ user.name }}</td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-8">
                <div class="form-inline">
                    <div class="input-group">
                        <div class="input-group-addon">选择结果：</div>
                        <div class="input-group-addon">工号</div>
                        <input type="text" class="form-control" v-model="layer.chooseUser.username" readonly/>
                        <div class="input-group-addon">姓名</div>
                        <input type="text" class="form-control" v-model="layer.chooseUser.name" readonly/>
                    </div>
                </div>
            </div>
        </div>
</div>
</div>

<script src="${request.contextPath}/statics/js/modules/eval/evaltask.js?_${.now?long}"></script>
</body>
</html>